<template>
  <h1>事件绑定指令</h1>
  <!-- 下面两种写法是等价的,我们一般用第2种 -->
  <button v-on:click="f()">按钮</button>
  <button @click="f()">按钮2</button>

  <h3>敲回车事件</h3>
  <input type="text" placeholder="请搜索你喜欢的影片"
         @keydown.enter="ent()" v-model="search">
</template>

<script setup>
import {ref} from "vue";
const search = ref('');
const ent = ()=>{
  alert('您想搜索的内容是:'+search.value);
}

const f = ()=>{
  alert('点击了!');
}
</script>

<style scoped>

</style>